<?php
/*
Credits: Bit Repository
URL: http://www.bitrepository.com/web-programming/ajax/show-yahoo-weather.html
*/

error_reporting (E_ALL ^ E_NOTICE);

if(isSet($_GET['p'])) // at least 'p' is required
{
$p = $_GET['p'];

$u = isSet($_GET['u']) ? $_GET['u'] : '';

require('magpierss/rss_fetch.inc');

$url = 'http://weather.yahooapis.com/forecastrss?p='.$p.'&u='.$u;
//$url = "http://www.google.com/ig/api?weather=94303"

$rss = fetch_rss($url);

$title = $rss->items[0]['title'];
$title = '';
$description = $rss->items[0]['description'];
//print_r($rss);
$description = ereg_replace("\(provided by The Weather Channel\)", "", $description)."<br />";
echo "<br /> ".ereg_replace("<a href", "<a target='_blank' href", $description)."<br />";

}
?>
